﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Multiprocessing.Core.Algorithm;
using Multiprocessing.Core.Units;

namespace Multiprocessing.Analyse
{
    public sealed class Efficiency : BaseAnalyseUnit
    {
        #region Constructors

        public Efficiency(IAlgorithm algorithm) : base(algorithm)
        {
        }

        #endregion

        #region Methods 

        public override double Calculate(int processingUnitCount, params object[] args)
        {
            return new Acceleration(this.Algorithm).Calculate(processingUnitCount, args)/processingUnitCount;
        }

        public override double Calculate(int processingUnitCount, Type processingBlockType, out TimeSpan elapsed, params object[] args)
        {
            return new Acceleration(this.Algorithm).Calculate(processingUnitCount, processingBlockType, out elapsed, args)/processingUnitCount;
        }

        #endregion
    }
}
